<cpanel include="../../config.php">

<?

/***************************************************************************
 *                                 analog.php
 *                            -------------------
 *   Begin                : Thursday, April 16, 2005
 *   Copyright            : (C) 2005 Point and Code
 *   Domain               : http://www.pointandcode.com/
 *   Email                : support@pointandcode.com
 *   Version              : 1.0.1
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

$html_root_path = '../../';
include $root_path.'common.php';
$page_title = $lang['analog'];
include $root_path.'page_header.php';


$template->set_filenames(array(
	'body' => $root_path.$template_path.'stats/analog.tpl')
);

$is_analog_installed = <<<EOF
<cpanelif !$CONF{'skipanalog'} $CPDATA{'FEATURE-ANALOG'}><cpanelfeature analog>test</cpanelfeature></cpanelif>
EOF;

if (empty($is_analog_installed)) {
	message_die($lang['analog_not_installed']);
}

$analog_junk = <<<EOFpacman
<cpanel Stats="analoglist($FORM{'domain'})">
EOFpacman;

$analog_junk = explode('<br>', $analog_junk);
$array_of_analog = array();
$i=0;

foreach($analog_junk as $row) {
	$temp = explode('<a href=', $row);
	$temp2 = explode('>', $temp[1]);
	$array_of_analog[$i]['url'] = $temp2[0];

	// Get the month
	$temp3 = explode('</a>', $temp2[1]);
	$array_of_analog[$i]['month'] = $temp3[0];

	$i++;
};

foreach ($array_of_analog as $row) {
	if (!empty($row['url'])) {
		$template->assign_block_vars('analogrow', array(
			'URL' => $row['url'],
			'MONTH' => $row['month'],
		));
	};
};


$template->assign_vars(array(
	'STAT_DOMAIN' => $HTTP_GET_VARS['domain'],
	
	'L_ANALOG' => $lang['analog'],
	'L_ANALOG_SELECT_MONTH' => sprintf($lang['analog_select_month'], $HTTP_GET_VARS['domain']),
));



//
// Woohoo! All done!
//
$template->pparse('body');

include $root_path.'page_tail.php';


?>